package be.castanea.client.services;

import be.castanea.client.model.Movement;
import be.castanea.client.services.util.GenericCommand;
import be.castanea.common.util.PositionEvent;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;

/**
 * Castanea
 * 2009
 * @author Geert van Leemputten, Steven Rymenans, Bart Van Hooydonck
 */
public class ChangeMovement extends GenericCommand {

    @Override
    public void execute(float interpolation) {
        PositionEvent position = (PositionEvent) event;
        float[] locationArr = position.getLocation();
        Vector3f location = new Vector3f(locationArr[0], locationArr[1], locationArr[2]);
        getMob().setLocalTranslation(location);
        getMob().setLocalRotation(new Quaternion(position.getRotation()));
        getMob().setMovement(new Movement(position.getMovement()));
    }
}
